package com.gmail.shazi199.satoriex.stage.image;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;

import com.gmail.shazi199.satoriex.App;
import com.gmail.shazi199.satoriex.entity.Drawable;
import com.gmail.shazi199.satoriex.utils.Drawer;

public class StageFront implements Drawable {

    private static final Log LOGGER = LogFactory.getLog(StageFront.class);

    private Texture texture;
    private Picture[] front;

    @Override
    public void draw() {
        for (int i = 0; i < 4; i++) {
            Drawer.draw(texture, front[i]);
        }
    }

    public StageFront() {
        try {
            this.texture = TextureLoader.getTexture("PNG", App.class.getResourceAsStream("resource/image/front.png"));
        } catch (IOException e) {
            LOGGER.error("Load Texture error.", e);
            App.getApp().exit();
        }
        front = new Picture[] {
                new Picture(0, 0, 0, 0, 32, 480),
                new Picture(32, 0, 0, 480, 384, 16),
                new Picture(416, 0, 32, 0, 224, 480),
                new Picture(32, 464, 0, 496, 384, 16) };
    }
}
